package com.daxin.controller;

import com.daxin.pojo.Transfer;
import com.daxin.service.TransferService;
import com.daxin.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/transferMapper")
public class TransferController {
    @Autowired
    private TransferService transferService;

    @PostMapping("/transfer")
    public SysResult transfer(@RequestBody Transfer transfer){
        transferService.doTransfer(transfer);
        return SysResult.success();
    }

    //30天出账订单
    @GetMapping("/findLast30DaysOut/{dxId}")
    public SysResult findLast30DaysOut(@PathVariable String dxId){
        List<Transfer> transferList = transferService.findLast30DaysOut(dxId);
        return SysResult.success("ok",transferList);
    }

    //30天入账订单
    @GetMapping("/findLast30DaysIn/{dxId}")
    public SysResult findLast30DaysIn(@PathVariable String dxId){
        List<Transfer> transferList = transferService.findLast30DaysIn(dxId);
        return SysResult.success("ok",transferList);
    }

}
